FFLAGS = -static -ffixed-line-length-132 -g 

LDFLAGS = -L$(CERNLIB) -lgraflib -lmathlib -lpacklib

OBJSRCS = src/hb.f src/hbbook.f src/hbfill1.f src/hbfill2.f
OBJS = $(patsubst src/%.f,obj/%.o,$(OBJSRCS))

EXESRCS = src/hbread_cb.f
EXES = $(patsubst src/%.f,bin/%,$(EXESRCS))

obj/%.o: src/%.f
	gfortran -c $(FFLAGS) -o $@ $< 

bin/%: src/%.f $(OBJS)
	echo $(OBJS)
	gfortran $(FFLAGS) -o $@ $^ $(LDFLAGS)

.PHONY: clean all

all: $(EXES)

clean:
	rm -f $(OBJS) $(EXES)
